package com.hivekion.common.entity;

import com.baomidou.mybatisplus.annotation.FieldFill;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.gitee.sunchenbin.mybatis.actable.annotation.ColumnComment;
import com.gitee.sunchenbin.mybatis.actable.annotation.ColumnType;
import com.gitee.sunchenbin.mybatis.actable.constants.MySqlTypeConstant;
import lombok.Data;

import java.io.Serializable;
import java.util.Date;

@Data
public class BaseEntity implements Serializable {
      @TableId
      @ColumnType(value = MySqlTypeConstant.VARCHAR, length = 50)
      @ColumnComment("主键")
      private String id;

      @TableField(value = "createUserId", fill = FieldFill.INSERT)
      @ColumnType(value = MySqlTypeConstant.VARCHAR, length = 50)
      @ColumnComment("创建者")
      private String createUserId;

      @TableField(value = "createUserName", fill = FieldFill.INSERT)
      @ColumnType(value = MySqlTypeConstant.VARCHAR, length = 50)
      @ColumnComment("创建者")
      private String createUserName;

      @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
      @TableField(fill = FieldFill.INSERT)
      @ColumnType(MySqlTypeConstant.TIMESTAMP)
      @ColumnComment("创建时间")
      private Date createTime;

      @TableField(value = "updateUserId", fill = FieldFill.UPDATE)
      @ColumnType(value = MySqlTypeConstant.VARCHAR, length = 50)
      @ColumnComment("更新者")
      private String updateUserId;

      @TableField(value = "updateUserName", fill = FieldFill.UPDATE)
      @ColumnType(value = MySqlTypeConstant.VARCHAR, length = 50)
      @ColumnComment("更新者")
      private String updateUserName;

      @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
      @TableField(fill = FieldFill.UPDATE)
      @ColumnType(MySqlTypeConstant.TIMESTAMP)
      @ColumnComment("更新时间")
      private Date updateTime;

      @TableField
      @ColumnType(value = MySqlTypeConstant.BIT, length = 1)
      @ColumnComment("删除标识")
      private Boolean deleteFlag;

      @TableField
      @ColumnType(value = MySqlTypeConstant.VARCHAR, length = 255)
      @ColumnComment("备注")
      private String remark;
}
